﻿﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>考勤情况</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="/View_Mobile/CSS/msui.css">
    
    <link href="//cdn.bootcss.com/font-awesome/4.5.0/css/font-awesome.css" rel="stylesheet" />
    <link href="/View_Mobile/CSS/szhlextend.css?ver=20160904" rel="stylesheet" />
    <link rel="stylesheet" href="/View_Mobile/CSS/animate.css">

    <style type="text/css">
        .ms-controller, [ms-controller] {
            display: none;
        }
    </style>
</head>
<body ms-controller="list">
    <div class="page-group">
        <div class="page page-current" id="pageindex1">
            <div class="buttons-tab">
                <a href="#" ms-if="DataID=='-1'" ms-on-click="getdata(1)" class="tab-link button external" ms-class-1="active:type=='1'">本月迟到</a>
                <a href="#" ms-if="DataID=='-1'" ms-on-click="getdata(2)" class="tab-link button external" ms-class-1="active:type=='2'">本月早退</a>
                <a href="#" ms-if="DataID=='-1'" ms-on-click="getdata(3)" class="tab-link button external" ms-class-1="active:type=='3'">本月请假</a>
            </div>

            <div class="content infinite-scroll infinite-scroll-bottom" data-distance="50" style="margin-top:2rem" id="touchcontent">
                <div class="list-container">
                    <div class="card facebook-card animated fadeInUp" ms-repeat-el="ctData">
                        <div class="ribbon-wrapper-green" ms-if="el.TypeName" style="width:65px;height:68px;top: -2px;right: -2px;"><div class="ribbon-green" style="top: 10px;width: 100px;    padding: 4px;font-size:11px">{{el.TypeName}}</div></div>
                        <div class="card-header no-border" ms-on-click="showdetil(el)">
                            <div class="facebook-avatar"><img ms-src="{{ComFunJS.getfile()+'&type=TX&user='+type=='3'?el.CRUser:el.KQUser}}" style="border-radius: 3px;width:32px;height:32px"><div class="cadename" ms-if="!el.isfold">{{ComFunJS.convusers(type=='3'?el.CRUser:el.KQUser)}}</div></div>
                            <div class="facebook-date" ms-if="el.isfold">{{ComFunJS.convusers(type=='3'?el.CRUser:el.KQUser)}}</div>
                            <div class="facebook-date">{{$.timeago(type=='3'?el.CRDate:el.KQDate)}}</div>
                            <div class="facebook-date" ms-if="!el.isfold&&type=='3'" style="overflow: hidden; word-wrap: break-word; word-break: break-all; ">{{el.StarTime|date("yyyy-MM-dd")}} ~ {{el.EndTime|date("yyyy-MM-dd")}}</div>
                            <div class="facebook-date" ms-if="!el.isfold&&type=='3'" style="overflow: hidden; word-wrap: break-word; word-break: break-all; ">{{covtitle(el.ZhuYaoShiYou)}}</div>
                            <div class="facebook-date" ms-if="!el.isfold &&type!='3'" style="overflow: hidden; word-wrap: break-word; word-break: break-all; ">{{el.KQDate|date("yyyy-MM-dd HH:mm")}}</div>
                            <div class="facebook-date" ms-if="!el.isfold &&type!='3'" style="overflow: hidden; word-wrap: break-word; word-break: break-all; ">{{WeekData[el.WeekDay-1]}}</div>
                        </div>
                        <div class="card-content  " ms-visible="el.isfold">
                            <div ms-if="type=='3'">
                                <div class="card-content-inner" style="padding-bottom:0;padding-top: 0.4rem;"><span style="color:gray">请假时间：</span> {{el.StarTime|date("yyyy-MM-dd")}} ~ {{el.EndTime|date("yyyy-MM-dd")}}</div>
                                <div class="card-content-inner" style="padding-bottom:0;padding-top: 0.4rem;"><span style="color:gray">请假天数：</span> {{el.Daycount}} 天</div>
                                <div class="card-content-inner" style="padding-bottom:0;padding-top: 0.4rem;" ms-if="el.ChaoSongRen"><span style="color:gray">抄送人：</span>{{ComFunJS.convusers(el.ChaoSongRen)}}</div>
                                <div class="card-content-inner" style="padding-bottom:0;padding-top: 0.4rem;"><span style="color:gray">请假事由：</span> <span style="overflow: hidden; word-wrap: break-word; word-break: break-all; ">{{el.ZhuYaoShiYou|html}}</span></div>
                                <div class="card-content-inner" style="padding-bottom:0;    padding-top: 0.4rem;" ms-if="el.StateName!='-1'"><span style="color:gray">审核状态：</span> <span style="overflow: hidden; word-wrap: break-word; word-break: break-all; ">{{el.StateName|html}}</span></div>
                                <div class="card-content-inner" style="padding-top: 0; padding-top: 0.4rem; padding-bottom: 0;" ms-if="el.Files">
                                    <ul class="filelist">
                                        <li ms-repeat-file="el.FileList">
                                            <img ms-class="mall_pcp:ComFunJS.isPic(file.FileExtendName)" class="" ms-on-click="viewfile(file)" ms-src="{{ComFunJS.getfile(file.ID)}}" onerror="javascript: this.src = '/ViewV5/images/qywd/file.png'"/>
                                            <span class="fileinfo" ms-if="!ComFunJS.isPic(file.FileExtendName)">{{file.Name}}</span>
                                        </li>
                                    </ul>
                                </div>
                            </div>

                            <div ms-if="type!='3'">
                                <!--<div class="card-content-inner" style="padding-bottom:0;padding-top: 0.4rem;"><span style="color:gray">姓名：</span> {{ComFunJS.convusers(el.KQUser)}}</div>-->
                                <div class="card-content-inner" style="padding-bottom:0;padding-top: 0.4rem;"><span style="color:gray">{{type=='1'?'签到':'签退'}}时间：</span> <span style="color:red;">{{el.KQDate|date("yyyy-MM-dd HH:mm")}}</span></div>
                                <div class="card-content-inner" style="padding-bottom:0;padding-top: 0.4rem;"><span style="color:gray">星期：</span>{{WeekData[el.WeekDay-1]}}</div>
                            </div>
                        </div>
                    </div>
                    <div class="card facebook-card animated" ms-if="loadtip">
                        <div class="card-header no-border">
                            {{loadtip}}
                        </div>
                    </div>
                </div>
                <div class="infinite-scroll-preloader">
                    <div class="preloader"></div>
                </div>
            </div>
            <!--<span class="animated fadeIn" ms-if="DataID=='-1'" ms-click="changefold()" id="plus_list" style="z-index:99998;opacity:.9"><img ms-attr-src="'/View_Mobile/images/'+(isfold?'rwglss':'rwglzk')+'.png'"></span>-->

        </div>
        <div class="page" id="pageindex2">
        </div>
    </div>
    <script src="/View_Mobile/JS/layer/layer.m.js"></script>
    <script type='text/javascript' src='//g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='//g.alicdn.com/msui/sm/0.5.8/js/sm.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='//g.alicdn.com/msui/sm/0.5.8/js/sm-extend.min.js' charset='utf-8'></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
    <script src="/View_Mobile/JS/touch/toucher.js"></script>

    <script src="/View_Mobile/JS/avalon1.47.js"></script>
    <script src="/View_Mobile/JS/raty/jquery.raty.js?v=1.3"></script>
    <script src="/View_Mobile/JS/ComFunJS.js?jsver=20160425"></script>
    <script>

        var model = avalon.define({
            $id: "list",
            ctData: [],//数据源
            loading: false,
            loadtip: "",//切换页时显示信息
            nowuser: ComFunJS.getnowuser(),//当前用户
            isfold: "Y",//localStorage.getItem("listisfold") == "Y" ? true : false,//是否折叠显示
            changefold: function () {
                model.isfold = !model.isfold;
                model.ctData.forEach(function (item) {
                    item.isfold = model.isfold;
                })
                localStorage.setItem("listisfold", model.isfold ? "Y" : "N");
            },//改变折叠状态
            shNum: 0,
            page: 1,
            pagecount: 8,
            DataID: ComFunJS.getQueryString("ID", "-1"),//数据ID
            type: 0,//
            covtitle: function (title) {
                return ComFunJS.convstr($("<div>" + title + "</div>").text(), 20);
            },//转化 TITLE信息
            showdetil: function (item) {
                //item.isfold = !item.isfold
            },//展开显示信息
            WeekData: ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],
            loadMore: function () {
                if (model.loading) return;
                model.loading = true;
                $.getJSON("/API/VIEWAPI.ashx?Action=XTGL_GETRLZYLIST&r=" + Math.random(), { P1: model.type, "p": model.page }, function (r) {
                    model.loading = false;
                    if (r.ErrorMsg == "") {
                        if (model.page == 1 && r.Result.length == 0) {
                            model.loadtip = '没有找到数据哦'
                        }
                        for (var i = 0; i < r.Result.length; i++) {
                            r.Result[i].isfold = model.isfold;
                            if (model.DataID != "-1") {//如果有数据ID，则展开显示
                                r.Result[i].isfold = true;
                            }
                        }

                        model.ctData.pushArray(r.Result);
                        //判断是否加载完毕
                        if (r.Result.length < model.pagecount) {
                            // 加载完毕，则注销无限加载事件，以防不必要的加载
                            $.detachInfiniteScroll($('.infinite-scroll'));
                            // 删除加载提示符
                            $('.infinite-scroll-preloader').hide();
                            return;
                        }
                        $.refreshScroller();
                        model.page += 1;
                    }

                });

            },
            viewfile: function (file) {
                if (ComFunJS.isPic(file.FileExtendName)) {
                    ComFunJS.viewbigimg(this)
                    return;
                }
                if (ComFunJS.isOffice(file.FileExtendName) && file.ISYL == "Y") {
                    window.location = file.YLUrl;
                    return;
                }
            },//文件查看方法
            getdata: function (type) {
                $.attachInfiniteScroll($('.infinite-scroll'))
                model.loadtip = "";
                $('.infinite-scroll-preloader').show();
                model.type = type;
                model.ctData.clear();
                //model.loadtip = "正在加载数据... ...";
                //setTimeout("model.loadtip = '没有找到数据哦'", 1500)
                model.page = 1;
                model.loadMore();
            }
        })
        avalon.ready(function () {
            // 注册'infinite'事件处理函数
            $(document).on('infinite', '.infinite-scroll-bottom', function () {
                model.loadMore();
            });

            $.init();
            if (model.DataID == "-1") {//如果参数中没有数据ID，则默认抓取当前用户数据
                var te = ComFunJS.getQueryString("type", "1");
                model.type = te * 1;
                util.toucher(document.getElementById('touchcontent'))
                .on('swipeLeft', '.list-container', function () {
                    model.type = model.type == 3 ? 1 : model.type * 1 + 1;
                    model.getdata(model.type)
                    return false;
                })
                .on('swipeRight', '.list-container', function () {
                    model.type = model.type == 1 ? 3 : model.type * 1 - 1;
                    model.getdata(model.type)

                    return false;
                })//左右滑动事件
            }
            model.getdata(model.type);
        })
    </script>
</body>

</html>